package com.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.bean.AreaBean;
import com.project.dao.IAreaDao;
import com.project.service.IAreaService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author RJ
 * @date 2022/9/14 22:15
 */
@Service
@Transactional
public class AreaServiceImpl extends ServiceImpl<IAreaDao, AreaBean> implements IAreaService {
    @Override
    public void addArea(AreaBean areaBean) {
        this.save(areaBean);
    }

    @Override
    public IPage<AreaBean> cutAreaByItem(Integer pageNo, Integer pageSize, String areaName, String areaForestType, String className) {
        Page<AreaBean> page = new Page<>(pageNo, pageSize);
        IPage<AreaBean> iPage = this.baseMapper.cutAreaByItem(page, areaName, areaForestType, className);
        return iPage;
    }

    @Override
    public List<AreaBean> findArea() {
        return this.baseMapper.findArea();
    }
}
